$(window).ready(function(){
	setTimeout(function(){menu_resize();},100);
	
	
});

function menu_resize(){
	$("body").height($(window).height());
	var win_wid = $(window).outerWidth();
	if(win_wid < 1200){
		win_wid = 1200;
	}
	$("body").width(win_wid);
}

$(window).resize(function(){
	menu_resize();
});

function out_login(){
	window.location.href = "/fw/j_spring_security_logout";
}

function change_menu(obj,index){
	//var home_pages = ["home","present","case","help2","about","register","login"];
	var home_pages = ["login","register","suggest","home"];
	window.location = '/fw/pages/home/'+home_pages[index-1]+'.jsp';
}

function change_menu_css(index){
	$(".top_menus .menus .menu.menu").removeClass("click").removeClass("click2");
	$(".top_menus .menus .menu.menu"+index).addClass("click");
}

function goOtherPage(){
	location.href="/fw/pages/home/home.jsp";
}

/**设置指定大小*/
 $.fn.setWidthSize = function(obj){
	 var width=obj.width,//width
	 	height=obj.height,//height
	 	isScaleByWidth = obj.isScaleByWidth == null ? false:true,//是否以width为基准---比例
		reduceWidth=obj.reduceWidth,//减少width
		reduceHeight=obj.reduceHeight,//减少height
		isScale = obj.isScale == null ? true:false,//是否是按比例，
		isEqual = obj.isEqual == null ? false:true,//是否相等--如相等--直接以width为基准
		marginRight = obj.marginRight,//是否向右间距--值为px
		marginLeft = obj.marginLeft,
		widthAndHeightScale = obj.widthAndHeightScale == null ? false:obj.widthAndHeightScale,//长于宽的比例--以width为基准
	 	reduce_parWidth = obj.reduce_parWidth;//开始计算时，对window.width()后的减少
	 	parent_div = obj.parent_div;//是否以parent_div来计算宽度,高度
	 	parent_width = obj.parent_width;
		//是否向左间距--值为px
	//默认按比例
	 var winWidth = $(window).width();
	 if(parent_div){
		 winWidth = parent_div.width();	
	 }
	 if(parent_width){
		 winWidth = parent_width;	
	 }
	 
	 if(reduce_parWidth){
		 winWidth -= reduce_parWidth;
	 }
	 
	 
	 
	 
	 if(isScale){
		 if(width){
			 width = winWidth*width;
		 }
		 if(height){
			 if(isScaleByWidth){
				 height = winWidth*height;
			 } else{
				 var winHeight = $(window).height();	
				 height = winHeight*height;
			 }
		 }
	 }
	 
	 if(reduceWidth){//需要进行减的长度
		 width -= reduceWidth;
	 }
	 
	 if(reduceHeight){//需要进行减的高度
		 height -= reduceHeight;
	 }
	 
	 if(isEqual){//相等以width为基准
		 height = width;	
	 }
	 //向右间距
	 if(marginRight){
		 $(this).css("marginRight",marginRight+"px");
	 }
	 //向左间距
	 if(marginLeft){
		 $(this).css("marginLeft",marginLeft+"px");
	 }
	 //长宽比例
	 if(widthAndHeightScale){
		 height = width/widthAndHeightScale;
	 }
	 if(width){
		 $(this).width(width);
	 }
	 if(height){
		 $(this).height(height);
	 }
	 
}